﻿using MediatR;
using Micro.Extensions.DDD.Events;
using Module.Test.Domain.Events.Customs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Module.Test.Domain.EventHandlers
{
    /// <summary>
    /// CustomEvent 事件处理
    /// </summary>
    public class CustomEventHandler : EventsHandler,
        INotificationHandler<RegisteredCustomEvent>,
        INotificationHandler<RemovedCustomEvent>,
        INotificationHandler<UpdatedCustomEvent>
    {
        /// <summary>
        /// 被注册成功后的事件处理方法
        /// </summary>
        /// <param name="message"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task Handle(RegisteredCustomEvent notification, CancellationToken cancellationToken)
        {
            // 恭喜您，注册成功。

            return Task.CompletedTask;
        }

        public Task Handle(RemovedCustomEvent notification, CancellationToken cancellationToken)
        {
            // 恭喜您，更新成功。

            return Task.CompletedTask;
        }

        public Task Handle(UpdatedCustomEvent notification, CancellationToken cancellationToken)
        {
            // 您已经删除成功啦。

            return Task.CompletedTask;
        }
    }
}
